package com.jiepu.daily.corejava.advanceed.part3exception.day0728;

import java.util.InputMismatchException;
import java.util.Scanner;

/**
 * @Description:note
 * @author: xinjie.txt
 * @date: 2020/7/28  9:50
 */
public class ExceptionDemo3 {
	public static void main(String[] args) {

		int n1=0,n2=0;
		Scanner scanner = new Scanner(System.in);
		while (true){
			try {
				System.out.println("INPUT FIRST NUMBER: ");
				n1= scanner.nextInt();
				System.out.println("INPUT FIRST NUMBER: ");
				n2= scanner.nextInt();
				break;
			}catch (InputMismatchException e){
				scanner.next();
				System.out.println("Sorry,Input ERROR! ");
			} // catch
		} // while
		System.out.println("RESULT: "+(n1+n2));
	}
}
